package com.itheima.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealCheckGroupDao {

    @Select("select * from t_setmeal_checkgroup where checkgroup_id=#{checkGroupId}")
    Integer countByCheckGroupId(Integer checkGroupId);

    @Select("select checkgroup_id from t_setmeal_checkgroup where setmeal_id=#{setmealId}")
    List<Integer> findCheckGroupIdsBySetmealId(Integer setmealId);

    @Insert("insert into t_setmeal_checkgroup(setmeal_id, checkgroup_id) values (#{setmealId}, #{checkgroupId})")
    void insert(Integer setmealId, Integer checkgroupId);

    @Delete("delete from t_setmeal_checkgroup where setmeal_id=#{setmealId}")
    Integer deleteBySetmealId(Integer setmealId);
}
